home *** CD-ROM | disk | FTP | other *** search
- Subject: Bug, reading and writing to SU
- Sent: 7/22/96 12:11 AM
- Received: 7/22/96 10:48 AM
- From: Arni McKinley, motion@nbn.com
- Reply-To: ODF Interest, ODF-Interest@CILabs.ORG
- To: OpenDoc Development Framework Discussion List, ODF-Interest@CILabs.
-
- I have come across a situation which yields a crash in the following way:
- (1) I externalize my part, during which I write out a shapeList (ala
- ODFDraw) to a value in a property that I have added specially to the part's
- storage unit.
- (2) I then embed a part, using CProxyShape, like in ODFDraw, adding it to
- the above shapeList.
- (3) A bit later, but before the part is externalized, I get the storage
- unit from my part, and write out the shape list to that same value and
- property.
-
- When it reaches the proxy, it passes through this code in
- FW_CProxyFrame::ExternalizeProxyFrame():
- ODStorageUnitRef aSURef;
- FW_CByteArray byteArray(&aSURef, sizeof(ODStorageUnitRef));
- suView->GetStrongStorageUnitRef(ev, fFrameID, aSURef);
- suView->SetValue(ev, byteArray);
-
- (4) A bit later, I attempt to read the list back in. When the proxy is
- read, this code is used in FW_CProxyFrame::InternalizeProxyFrame():
- ODStorageUnitRef aSURef;
- FW_CByteArray byteArray;
-
- // ----- Read reference -----
- suView->GetValue(ev, sizeof(ODStorageUnitRef), byteArray);
- byteArray.CopyBuffer(&aSURef, sizeof(ODStorageUnitRef));
-
- if (!suView->IsValidStorageUnitRef(ev, aSURef))
- return FALSE;
-
- which is gets through just fine, so the 'aSURef' I wrote out is good. The
- code then attempts to set the proxy's 'fContainingFrameID':
-
- ODStorageUnitID fromFrameID = suView->GetIDFromStorageUnitRef(ev, aSURef);
-
- // ----- Save the frame's draft
- fFrameDraft = suView->GetStorageUnit(ev)->GetDraft(ev);
-
- // ----- Cache the id of the containing frame -----
- FW_CAcquiredODStorageUnit aqFrameSU =
- fFrameDraft->AcquireStorageUnit(ev, fromFrameID);
- aqFrameSU->Focus(ev, kODPropContainingFrame, kODPosUndefined,
- kODWeakStorageUnitRef, 0, kODPosUndefined);
-
- aqFrameSU->GetValue(ev, sizeof(ODStorageUnitRef), byteArray);
- byteArray.CopyBuffer(&aSURef, sizeof(ODStorageUnitRef));
-
- if (aqFrameSU->IsValidStorageUnitRef(ev, aSURef))
- fContainingFrameID = aqFrameSU->GetIDFromStorageUnitRef(ev, aSURef);
- else
- fContainingFrameID = kODNULLID;
-
- // ----- Now we can set the frame ID -----
- fFrameID = fromFrameID;
-
- For some reason, aqFrameSU is invalid, so the fContainingFrameID becomes
- NULL. This makes it impossible for the proxy to find its containing frame,
- and a bit later, when I write out the list again, it crashes in
- FW_MProxy::Externalize() at the following line:
-
- if (proxyFrame->GetContainingFrame(ev)->IsPersistent(ev))
- count++;
-
- since the containing frame is NULL.
-
- _______
- Uh, anyone know why there is no strong reference in the storage unit to the
- containing frame?
-
- I have noticed that the storage unit can be found if I externalize the
- entire part just after embedding. I have no problem finding the proxy's
- containing frame thereafter.
-
- Thanks,
-
- Arni
-
- _______________________________________
- Arnold F. McKinley
- President
- MetaMind Software, Inc.
- 342 Lowell Ave.
- Mill Valley, CA 94941
- 415-381-8063
- FAX: 415-389-8969
- motion@nbn.com
- _______________________________________
-
-
-